package com.gimi.cloud.jimi.dao.dao.homePage;

import com.gimi.cloud.jimi.dao.myMapper.MyMapper;
import com.gimi.cloud.jimi.dto.app.MajorAdDTO;
import com.gimi.cloud.jimi.entity.app.MajorAdEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by shazhiwei on 2017/12/28.
 */
public interface MajorAdDao extends MyMapper<MajorAdEntity>{

    @Select("SELECT id,ad_name,publish_time,end_time,type,coment,page_id,img_url,target_url,position_num,title,sub_title,ad_class,ad_object " +
            "FROM jimi_major_ad WHERE page_id = #{pageId} AND ad_status = 'd' ORDER BY position_num ASC;")
    List<MajorAdDTO> getList(@Param(value = "pageId") Integer pageId);

    /**
     * 获得首页广告列表（分页），支持条件查询
     * @param majorAdDTO
     * @return
     */
    List<MajorAdDTO> queryPageList(MajorAdDTO majorAdDTO);

    @Select("select * from jimi_major_ad where ad_name=#{adName} LIMIT 1")
    MajorAdEntity selectMajorAdEntityByadName(MajorAdDTO majorAdDTO);
}
